/*
*
*在typescript中，类的属性和方法支持三种修饰符：public、private、protected
*   public修饰符：修饰的是在任何地方可见、公有的属性或方法，默认编写的属性就是使用public修饰符
*   private修饰符：修饰的是仅仅在同一个类中可见、私有的属性或方法
*   protected：修饰的是仅仅在类自身及子类中可见、受保护的属性或方法
* */
class Person {
    private name: string
    private age: number
    public address: string

    constructor(name: string, age: number, address: string) {
        this.name = name
        this.age = age
        this.address = address
    }

    public getName(): string {
        return this.name
    }

    public setName(name: string): void {
        this.name = name
    }
}

const p: Person = new Person("陶品奇", 18, "衡阳")
console.log(p.getName())
console.log(p.address)